import { createRouter, createWebHistory } from 'vue-router'

import PageRouter from './page/index'
import ViewRouter from './views/index'
import {useRouterStore} from "@/stores";


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [...PageRouter, ...ViewRouter]
})



// 在页面即将刷新时保存当前路由信息
window.addEventListener('beforeunload', () => {
  localStorage.setItem("beforeunload",JSON.stringify(router.currentRoute.value))

})


export default router
